import 'package:base_plugin/base_plugin.dart';
import 'package:finance_app/generated/l10n.dart';
import 'package:finance_app/src/common/app_colors.dart';
import 'package:finance_app/src/entities/promo_code_entity.dart';
import 'package:flutter/material.dart';

class SubPromoCodeItem extends StatelessWidget {
  final PromoCodeEntity data;

  SubPromoCodeItem({Key key, this.data}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      decoration: (BoxDecoration(
        color: Colors.white,
        boxShadow: [
          BoxShadow(
            color: Colors.black.withOpacity(0.25),
            blurRadius: getDp(3),
            spreadRadius: -getDp(1),
          )
        ],
        borderRadius: BorderRadius.circular(10),
      )),
      child: Column(
        children: [
          Container(
            padding: EdgeInsets.symmetric(vertical: 5),
            decoration: BoxDecoration(
              color: aceBlueColor,
              borderRadius: BorderRadius.vertical(top: Radius.circular(10)),
            ),
            child: Center(
              child: Text(
                S.current.promo_code_applied,
                style: TextStyle(color: Colors.white),
              ),
            ),
          ),
          Container(
            padding: EdgeInsets.symmetric(horizontal: 10, vertical: 16),
            child: Container(
              child: Text(
                  data.discountType == 'value'
                      ? '\$ ${data.discountValue} OFF'
                      : '${data.discountValue}% OFF',
                  textAlign: TextAlign.center,
                  style: TextStyle(
                      color: aceBlueColor,
                      fontWeight: FontWeight.bold,
                      fontSize: 17)),
            ),
          ),
        ],
      ),
    );
  }
}
